<#assign packageName = content.items.controller.packageName>
<#assign tableName = content.content.tableName>
<#assign lowerName = content.content.lowerName>
<#assign camelName = content.content.camelName>
<#assign listLength = content.content.fields?size>
<#assign fieldList = content.content.fields>
<template>
    <el-dialog title="详细" :visible.sync="visible" append-to-body width="60%" @close="closeDialog">
        <div class="table-box">
            <table width="100%">
                <tbody>
                <#assign forNum = 0>
                <#list  0..listLength-1 as i>
                    <#if forNum<=listLength-1>
                <tr>
                    <th width="120px"><#if fieldList?? && fieldList?size gt 0>${fieldList[forNum].remark?default("")}</#if></th>
                    <td width="100px">{{ form.${fieldList[forNum].fieldName} }}</td>
                <#if listLength-1==forNum>
                </tr>
                    <#break>
                <#else>
                    <th width="120px"><#if fieldList[forNum+1].fieldRemark??>${fieldList[forNum+1].fieldRemark}</#if></th>
                    <td width="100px">{{ form.${fieldList[forNum+1].fieldName} }}</td>
                </#if>
                </tr>
                <#assign forNum = forNum+2 >
                </#if>
                </#list>
                </tbody>
            </table>
        </div>

        <div>
            <h5>附件列表</h5>
            <ibp-attachment ref="customupload" :total-size="totalSize" :show-btn="showBtn" :single-size="singleSize" :file-suff="fileSuff" :apptype="apptype"/>
        </div>

    </el-dialog>


</template>

<script>
import IbpAttachment from '@/views/components/IbpAttachment/index.vue'
export default {
    name: 'dispModule',
    components: {IbpAttachment},
    props: {
        show: {
            type: Boolean,
            default: false
        },
        dialogType: {
            type: String,
            default: ''
        }
    },
    data() {
        return {
            form: {},
            total: 0,
            showBtn: false,
            fileSuff: [],
            singleSize: '',
            totalSize: '',
            apptype: '${camelName}',
            /*****数据字典*******/
            selectDict: [//数据字典
                {dictValue:'1',dictLabel:'选项1'},
                {dictValue:'2',dictLabel:'选项2'},
                {dictValue:'3',dictLabel:'选项3'}
            ]
        }
    },
    computed: {
        visible: {
            get() {
                return this.show
            },
            set(val) {
                this.$emit('update:show', val)
            }
        }
    },
    created() {
        // 下拉框
      //  this.getDicts('').then((response) => {
         //   this.selectDict = response.data
       // })
        // 获取附件上传支持后缀
        this.getConfigKey('sys.attach.fileSuff').then((response) => {
            this.fileSuff = response.msg
        })
        // 获取附件上传单文件大小
        this.getConfigKey('sys.attach.singleSize').then((response) => {
            this.singleSize = response.msg
        })
        // 获取附件上传全部文件大小
        this.getConfigKey('sys.attach.totalSize').then((response) => {
            this.totalSize = response.msg
        })
    },
    methods: {
        // 字段转码
        statusFormat(prop,value) {
            if(prop === 'flowstatus') return this.selectDictLabel(this.selectDict, value)
        },
        // 获取回显数据
        getForm(data) {
            this.form = Object.assign({}, data)
            <#if content.content.primaryField??>
            <#assign assign_idFieldName = content.content.primaryField[0].fieldName>
            this.$refs['customupload'].handleGetFileList(data.${assign_idFieldName}, '${camelName}')
            </#if>
        },

        // 关闭弹框
        closeDialog() {
            this.$emit('update:show', false)
        }
    }
}
</script>

<style scoped lang="scss">
    .table-box {
        margin-bottom: 30px;
        border: 1px solid #e4e7fd;
        font-size: 12px;
        border-radius: 8px;
        text-align: center;

    table {
        width: 100%;
        border-collapse: collapse;
    }

    caption {
        padding: 10px;
        border-bottom: 1px solid #e4e7fd;
        font-weight: bold;
    }

    th {
        background: #f8f8f8;
    }

    td,
    th {
        padding: 10px;
        border-right: 1px solid #e4e7fd;
        border-bottom: 1px solid #e4e7fd;

    &:last-child {
         border-right: none;
     }
    }

    td:last-child {
        border-right: none;
    }

    tr:last-child td,
    tr:last-child th {
        border-bottom: none;
    }

    .thead th,
    .thead td {
        text-align: center;
    }
    }
</style>
